<template>
    <div>
            <Card>
                <p slot="title">
				    添加物流订单
			    </p>
                <div>
                    <Form class="step-form" ref="orderData" :model="orderData" :rules="orderDataRules" :label-width="100">
                        <Row span="24" style='margin-top:5px;'>
                            <i-col class='small-title' span="2" >
                                单据信息
                            </i-col>
                        </Row>
                        <Row span="24" style='margin-top:5px;'>
                            <i-col span="8" >
                                <FormItem label="订单编号：" prop="trade_order_id">
                                    <Select  filterable remote label-in-value
                                        :remote-method="remoteMethod1" :loading="loading1"  clearable>
                                        <Option @click.native="selectOrderNo(item)" v-for="(item,index) in orderNoList" :value="item.label" :key="index" :label="item.value">{{ item.value }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                            <i-col span="8" >
                                <FormItem label="公司名称：" prop="party_name">
                                    <Select  filterable remote label-in-value
                                        :remote-method="remoteMethod2" :loading="loading2" clearable >
                                        <Option @click.native="setPartyInfo(item)" v-for="(item,index) in partyList" :data="item.value" :value="item.label" :key="index" :label="item.value">{{ item.value }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                            <i-col span="8" >
                                <FormItem label="发车日期：" prop="begin_date" label-position="left" :label-width="100">
                                   <Date-picker  type="datetime" format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期和时间" style="width: 200px" @on-change="orderData.begin_date=$event"></Date-picker>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24" style='margin-top:5px;'>
                            <i-col class='small-title' span="2" >
                                客户信息
                            </i-col>
                        </Row>
                        <Row span="24">
                            <i-col span="4" >
                                <FormItem prop="" label="始发地：" label-position="left" :label-width="100">
                                    <Select filterable style="width:120px">
                                        <Option @click.native="setArea(item)" v-for="(item,index) in provinceList" :value="item.cityCode" :key="index" :label="item.cityName">{{ item.cityName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                            <i-col span="6" >
                                <FormItem prop="" label="" label-position="left" :label-width="0">
                                    <Select clearable style="width:150px" >
                                        <Option @click.native="setCityArea(item)" v-for="(item,index) in cityList" :value="item.cityCode" :key="index" :label="item.cityName">{{ item.cityName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                            <i-col span="4" >
                                <FormItem prop="" label="目的地：" label-position="left" :label-width="100">
                                    <Select style="width:150px" label-in-value >
                                        <Option @click.native="setEndArea(item)" v-for="(item,index) in end_provinceList" :value="item.cityCode" :key="index" :label="item.cityName">{{ item.cityName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                            <i-col span="7" >
                                <FormItem prop="" label="" label-position="left" :label-width="0">
                                    <Select clearable style="width:150px" >
                                        <Option @click.native="setCityEndArea(item)" v-for="(item,index) in end_cityList" :value="item.cityName" :key="index" :label="item.cityName">{{ item.cityName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                            <i-col span="2" >
                                <Button type="success" @click="showTransportInfo()" size="large">选择公司</Button>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <div style='margin-top:0px;'>
                                <Table border :columns="transport_columns_show" :data="transport_infos_show"></Table>
                            </div>
                        </Row>
                        <Row span="24" style='margin-top:20px;'>
                            <i-col class='small-title' span="2" >
                                车辆信息
                            </i-col>
                            <i-col style='color:#3399ff;' span="2" >
                               <span @click="addCar()">添加车辆</span>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <div style='margin-top:20px;'>
                                <Table border :columns="feedback_columns" :data="feedback_data"></Table>
                            </div>
                        </Row>
                        <Row span="24" style='margin-top:25px;'>
                            <i-col class='small-title' span="2" >
                                托运信息
                            </i-col>
                        </Row>
                        <Row span="24" style='margin-top:5px;'>
                            <i-col span="8" >
                                <FormItem label="发车人姓名：" prop="send_person" label-position="left" :label-width="100">
                                   <Input v-model="orderData.send_person" :disabled="false"  type="text" placeholder="请输入交车人姓名"></Input>
                                </FormItem>
                            </i-col>
                            <i-col span="8" >
                                <FormItem label="发车人电话：" prop="send_person_phone" label-position="left" :label-width="100">
                                   <Input v-model="orderData.send_person_phone" :disabled="false"  type="text" placeholder="请输入交车人电话"></Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem  label="上门提车：" label-position="left" :label-width="100">
                                    <Checkbox style="margin: 0 auto;" v-model="location_check">
                                    </Checkbox>
                                     <Input v-model="orderData.send_person_addr" :disabled="!location_check" type="text" placeholder="请输入上门提车地址（详细到街道门牌号）" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24" style='margin-top:5px;'>
                            <i-col span="10" >
                                <FormItem label="收车人姓名：" prop="receive_person" label-position="left" :label-width="100">
                                   <Input v-model="orderData.receive_person" :disabled="false"  type="text" placeholder="请输入提车人姓名"></Input>
                                </FormItem>
                            </i-col>
                            <i-col span="10" >
                                <FormItem label="收车人电话：" prop="receive_person_phone" label-position="left" :label-width="100">
                                   <Input :disabled="false" v-model="orderData.receive_person_phone" type="text" placeholder="请输入提车人电话"></Input>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <i-col span="3" >
                                <FormItem  label="送车上门：" label-position="left" :label-width="100">
                                    <Checkbox style="margin: 0 auto;" v-model="location_check_lift">
                                    </Checkbox>
                                </FormItem>
                            </i-col>
                            <i-col span="10" >
                                <FormItem  label="送车地址：" label-position="left" :label-width="100">
                                     <Input  :disabled="!location_check_lift" v-model="orderData.receive_person_addr" type="text" placeholder="请输入送车地址" />
                                </FormItem>
                            </i-col>
                            <i-col span="10" >
                                <FormItem  label="身份证号：" label-position="left" :label-width="100">
                                     <Input  :disabled="!location_check_lift" v-model="orderData.user_card" type="text" placeholder="请输入身份证号" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24" style='margin-top:25px;'>
                            <i-col class='small-title' span="2" >
                                发票信息
                            </i-col>
                            <i-col span="3" >
                                <FormItem  label="开具发票：" label-position="left" >
                                    <Checkbox style="margin: 0 auto;" v-model="location_check_invoice">
                                    </Checkbox>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <i-col span="7" >
                                <FormItem  label="发票类型：" label-position="left" :label-width="100">
                                     <Radio-group v-model="invoice_data.invoice_type">
                                        <Radio :label="0">普通发票</Radio>
                                        <Radio :label="1">增值税发票</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                            <i-col span="7" >
                                <FormItem  label="发票抬头：" label-position="left" :label-width="100">
                                     <Input v-model="invoice_data.cust_name"  :disabled="!location_check_invoice" type="text" placeholder="请输入发票抬头" />
                                </FormItem>
                            </i-col>
                            <i-col span="7" >
                                <FormItem  label="税号：" label-position="left" :label-width="100">
                                     <Input v-model="invoice_data.taxpayer_no" :disabled="!location_check_invoice" type="text" placeholder="请输入发票税号" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <i-col span="7" >
                                <FormItem  label="单位地址：" label-position="left" :label-width="100">
                                     <Input v-model="invoice_data.cust_addr"  :disabled="!location_check_invoice" type="text" placeholder="请输入单位地址" />
                                </FormItem>
                            </i-col>
                            <i-col span="7" >
                                <FormItem  label="联系电话：" label-position="left" :label-width="100">
                                     <Input v-model="invoice_data.cust_phone"  :disabled="!location_check_invoice" type="text" placeholder="请输入联系电话" />
                                </FormItem>
                            </i-col>
                            <i-col span="7" >
                                <FormItem  label="开户银行：" label-position="left" :label-width="100">
                                     <Input v-model="invoice_data.depositBank" :disabled="!location_check_invoice" type="text" placeholder="请输入开户银行" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="24">
                            <i-col span="7" >
                                <FormItem  label="银行账号：" label-position="left" :label-width="100">
                                     <Input v-model="invoice_data.account"  :disabled="!location_check_invoice" type="text" placeholder="请输入银行账号" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <FormItem style='margin-top:50px;'>
                            <Button :disabled="hasSubmit" @click="saveData" style="width:100px;" type="primary">保存</Button>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <Button :disabled="hasSubmit" @click="goBack" style="width:100px;" >返回</Button>
                        </FormItem>
                    </Form>
                </div>
            </Card>
            <Modal v-model="addCarModel" title="添加运送车辆" :width="600"  :mask-closable="false">
                <div class="clearfix">
                    <Form class="step-form" :model="car_data"  :label-width="100">
                        <Row span="12">
                            <i-col span="6">
                                <FormItem  label="品牌：" label-position="left" :label-width="100">
                                    <Select style="width:200px"  label-in-value >
                                        <Option @click.native="setBrandInfo(item)" v-for="(item,index) in brands" :value="item.brandName" :key="index" :label="item.brandName">{{ item.brandName }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="6">
                                <FormItem prop="seriesId" label="品牌车系：" label-position="left" :label-width="100">
                                    <Select clearable style="width:200px" label-in-value >
                                        <Option-group v-for="(ite,i) in series" :key="i" :label="ite.subBrand">
                                            <Option  @click.native="setCarSeries(item)" v-for="(item,index) in ite.carSeries" :value="item.seriesId" :key="index"  :label="item.seriesName">{{ item.seriesName }}</Option>
                                        </Option-group>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem  label="车辆类型：" label-position="left" :label-width="100">
                                    <Select style="width:200px" v-model="car_data.car_size" label-in-value >
                                        <Option  v-for="(item,index) in carType" :value="item.value" :key="index" :label="item.value">{{ item.value }}</Option>
                                    </Select>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20">
                                <FormItem label="车辆状态：" label-position="left" :label-width="100">
                                   <Radio-group v-model="car_data.can_drive">
                                        <Radio :label="0">不能启动</Radio>
                                        <Radio :label="1">能启动</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="车辆估值："  label-position="left" :label-width="100">
                                    <Input  v-model="car_data.valuation" type="text" placeholder="请输入车辆估值（单位：万元）" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="运送数量：" label-position="left" :label-width="100">
                                    <Input  x-number="true"   v-model="car_data.car_count"  placeholder="请输入运送数量"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="20" >
                                <FormItem label="vin：" label-position="left" :label-width="100">
                                    <Input   v-model="car_data.vin" type="text" placeholder="请输入vin"/>
                                </FormItem>
                            </i-col>
                        </Row>
                    </Form>
                </div>
                <div slot="footer">
                    <div>
                        <Button type="success" style="margin:0 auto; display: block;" @click="saveCarOffer()">保存</Button>
                        <!-- <Button type="primary" @click="hideModel">取消</Button> -->
                    </div>
                </div>
            </Modal>
            <Modal v-model="transportModal" title="物流信息" :width="600"  :mask-closable="false">
                <div class="clearfix">
                    <Table border ref="selection" :columns="transport_columns" :data="transport_infos" @on-selection-change="selectChange"></Table>
                </div>
                <div slot="footer">
                    <div>
                        <Button type="success" style="margin:0 auto; display: block;" @click="saveTransportInfos()">确定</Button>
                    </div>
                </div>
            </Modal>
    </div>
</template>

<script>
import ajax from '../../../libs/axios.js'
export default {
    name: 'addUser',
    data () {
        return {
            testModelShow:false,
            location_check:false,
            location_check_lift:false,
            location_check_invoice:false,
            orderNoList:[],
            partyList:[],//公司集合
            provinceList:[],//省份集合
            cityList:[],//市的集合
            end_provinceList:[],//目的地省份集合
            end_cityList:[],//目的地市的集合
            loading1:false,
            loading2:false,
            addCarModel:false,
            transportModal:false,
            user_id:'',//当前登陆用户的id
            wlInfos:{
                code:'',//物流公司编码
                wlPrice:0 //物流价格
            },
            orderData: {
                trade_order_id: '',//订单编号
                begin_date:'',//发车日期
                begin_city_code:'',//始发地城市编码
                begin_city:'',//始发地城市
                end_city_code:'',//目的地城市编码
                end_city:'',//目的地城市
                begin_province_code:'',//始发地省份编码
                begin_province:'',//始发地省份
                end_province_code:'',//目的地省份编码
                end_province:'',//目的地省份
                need_take:0,//上门提车 1:需要 0:不需要
                need_give:0,//送车上门  1:需要 0:不需要
                need_invoice:0,//开具发票 1:需要 0:不需要
                party_id:'',//公司主体id
                party_name:'',//公司主体名称
                send_person:'',//发车人
                send_person_phone:'',//发车人手机号
                send_person_addr:'',//发车人地址
                receive_person:'',//收车人姓名
                receive_person_phone:'',//收车人手机号
                receive_person_addr:'',//收车人地址
                user_card:'',//收车人身份证号
                invoice:'',//发票
                carList:'',//车辆信息
                wlList:''//物流信息
            },
            address_data:{
                fromAddrCode:'',
                fromAddr:'',
                toAddrCode:'',
                toAddr:''
            },
            invoice_data:{
                invoice_type:0,//发票类型
                cust_name:'',//发票抬头
                taxpayer_no:'',//税号
                cust_addr:'',//单位地址
                cust_phone:'',//电话
                depositBank:'',//开户行
                account:''//银行卡号

            },
            brands:[],//车型信息
            series:[],//车系集合
            carType:[],//车系
            transport_infos:[],//公司列表
            transport_infos_show:[],//选中公司展示
            feedback_data:[],
            car_data:{
                car_brand:'',//车辆品牌
                car_series:'',//车系
                car_size:'',//车型
                can_drive:0,//是否能动
                valuation:'',//车辆估值
                car_count:1,//运送数量
                vin:''
            },
            transport_columns:[
                {
                    type: 'selection',
                    width: 60,
                    align: 'center'
                },
                {
                    title: '公司编号',
                    align: 'center',
                    key: 'companyCode'
                },
                {
                    title: '公司名称',
                    align: 'center',
                    key: 'company'
                },
                {
                    title: '价格',
                    align: 'center',
                    key: 'price'
                },
                {
                    title: '状态',
                    align: 'center',
                    key: 'isHasLine',
                    render: (h, params) => {
                        if (params.row.isHasLine === -1) {
                            return h('span', '该线路接口异常')
                        }else {
                                return h('span', '正常')
                        }
                    }
                },
            ],
            transport_columns_show:[
                {
                    title: '公司编号',
                    align: 'center',
                    key: 'companyCode'
                },
                {
                    title: '公司名称',
                    align: 'center',
                    key: 'company'
                },
                {
                    title: '价格',
                    align: 'center',
                    key: 'price'
                },
                {
                    title: '状态',
                    align: 'center',
                    key: 'isHasLine',
                    render: (h, params) => {
                        if (params.row.isHasLine === -1) {
                            return h('span', '该线路接口异常')
                        }else {
                                return h('span', '正常')
                        }
                    }
                },
                {
                    title: '操作',
                    key: 'action',
                    width: 180,
                    align: 'center',
                    render: (h, params) => {
                        return h('div', [
                            h(
                                'Button',
                                    {
                                        props: {
                                            type: 'error',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight:'5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.transportInfosDelete(params.index)
                                            }
                                        }
                                    },
                                    '删除'
                                )
                            ])
                        }
                    }
            ],
            feedback_columns: [
                    {
                        title: '车辆品牌',
                        align: 'center',
                        key: 'car_brand'
                    },
                    {
                        title: '车系',
                        align: 'center',
                        key: 'car_series'
                    },
                    {
                        title: '车型',
                        align: 'center',
                        key: 'car_size'
                    },
                    {
                        title: '是否能动',
                        align: 'center',
                        key: 'can_drive',
                        render: (h, params) => {
                            if (params.row.can_drive === 0) {
                                return h('span', '不能启动')
                            }else {
                                return h('span', '能启动')
                            }
                        }
                    },
                    {
                        title: '车辆估值',
                        align: 'center',
                        key: 'valuation'
                    },
                    {
                        title: '运送数量',
                        align: 'center',
                        key: 'car_count'
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 180,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h(
                                    'Button',
                                    {
                                        props: {
                                            type: 'error',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight:'5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.deleteCar(params.index,params.row.id)
                                            }
                                        }
                                    },
                                    '删除'
                                )
                            ])
                        }
                    }
                ],
            orderDataRules: {
                trade_order_id: [
                    { required: true, message: '请输入订单编号', trigger: 'blur'}
                ],
                party_name: [
                    { required: true, message: '请设置公司名称', trigger: 'blur'}
                ],
                begin_date:[
                    { required: true, message: '请设置出发时间', trigger: 'blur'}
                ],
                send_person:[
                    { required: true, message: '请输入发车人名称', trigger: 'blur'}
                ],
                send_person_phone:[
                    { required: true, message: '请输入发车人电话', trigger: 'blur'}
                ],
                receive_person:[
                    { required: true, message: '请输入收车人名称', trigger: 'blur'}
                ],
                receive_person_phone:[
                    { required: true, message: '请输入收车人电话', trigger: 'blur'}
                ],
            },
            hasSubmit: false
        }
    },
    methods: {
        // 数据初始化
        init () {
            let user_id = window.localStorage.getItem('userId')
            this.user_id = user_id
            this.$store.commit('setActiveName', 'orderhandleindex')
            this.initialization()
        },
        initialization(){
            let that = this
            let url = '/adminlogin/transport/initialization'
            let data = {}
            ajax.formRes(url, data).then(res => {
                if (200 == res.code) {
                    that.provinceList = res.cityList
                    that.end_provinceList = res.cityList
                    that.carType = res.carType
                    that.brands = res.brands
                } else {
                    that.$Message.success('数据原因，请联系管理员。');
                }
            }).catch(res => {
                 console.log('有错误信息')
            })
        },
        selectOrderNo(item){
            this.orderData.trade_order_id = item.value
        },
        setPartyInfo(obj){
            this.orderData.party_id = obj.label
            this.orderData.party_name = obj.value

        },
        setArea(obj){
            this.orderData.begin_province_code = obj.cityCode//始发地省份编码
            this.orderData.begin_province = obj.cityName//始发地省份
            this.cityList = obj.citys
        },
        setCityArea(obj){
            this.orderData.begin_city_code = obj.cityCode
            this.orderData.begin_city = obj.cityName
            this.address_data.fromAddrCode = obj.cityCode
            this.address_data.fromAddr = obj.cityName
        },
        setEndArea(obj){
            this.orderData.end_province_code = obj.cityCode//始发地省份编码
            this.orderData.end_province = obj.cityName//始发地省份
            this.end_cityList = obj.citys
        },
        setCityEndArea(obj){
           this.address_data.toAddrCode = obj.cityCode
           this.address_data.toAddr = obj.cityName
           this.orderData.end_city_code = obj.cityCode
           this.orderData.end_city = obj.cityName
        },
        setBrandInfo(obj){
            //获取车系列表
            this.car_data.car_brand = obj.brandName
            let url = '/adminlogin/transport/getCarSeriesByBrandId'
            let data = {
                brandId:obj.brandId
            }
            ajax.formRes(url, data).then(res => {
               this.series = res.data
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })

        },
        setCarSeries(obj){
            this.car_data.car_series = obj.seriesName
        },
        selectChange (seletion) {
            let newdata = []
            for (let index = 0; index < seletion.length; index++) {
                const element = seletion[index]
                newdata.push(element)
            }
            this.transport_infos_show = newdata
        },
        transportInfosDelete(index){
            this.transport_infos_show.splice(index, 1)
        },
        saveTransportInfos(){
            this.transportModal = false
        },
        //删除车辆信息
        deleteCar(index,id){
            this.feedback_data.splice(index, 1)
        },
        //展示物流信息
        showTransportInfo(){
            this.transportModal = true
            let url = '/adminlogin/transport/queryReferencePriceByCity'
            let data = this.address_data
            ajax.formRes(url, data).then(res => {
                this.transport_infos = res.data
            }).catch(res => {
                console.log('有错误信息')
                // fail
            })
        },
        //添加车辆
        saveCarOffer(){
            debugger
            let car = this.car_data
            this.feedback_data.push(car)
            this.addCarModel = false
        },
        // 提交数据
        saveData () {
            let that = this


            let temp =  this.feedback_data.length
            let temp1 =  this.transport_infos_show.length
            if(temp == 0){
                this.$Notice.error({
                    title: '错误提示',
                    desc: '请添加车辆信息'
                });
            }
            if(temp1 == 0){
                this.$Notice.error({
                    title: '错误提示',
                    desc: '请添加物流公司信息'
                });
            }
            if(temp>0 &&temp1>0){
                that.$refs['orderData'].validate((valid) => {
                    let data = this.orderData
                    data.user_id = this.user_id//设置当前登陆人员id
                    data.need_take = this.location_check?1:0//上门提车设置
                    data.need_give = this.location_check_lift?1:0//送车上门设置
                    data.need_invoice = this.location_check_invoice?1:0//是否开具发票设置
                    data.invoice = JSON.stringify(this.invoice_data)//设置发票类型
                    data.carList = JSON.stringify(this.feedback_data)//设置车辆信息
                    data.wlList = JSON.stringify(this.transport_infos_show)//设置物流公司信息
                    let url = 'adminlogin/transport/saveTransportOrderAndToInterfaceOrder'
                    ajax.formRes(url, data).then(res => {
                        if (200 == res.info.code) {
                            that.$router.push({
                                name: 'orderhandleindex'
                            })
                        } else {
                            that.$Message.success('数据原因，请联系管理员。');
                        }
                    }).catch(res => {
                        console.log('有错误信息')
                    })

                })
            }

        },
        remoteMethod1 (query) {
            let that = this
            if (query !== '') {
                this.loading1 = true;
                setTimeout(() => {
                    this.loading1 = false;
                    let url = '/adminlogin/transport/getCarOrderListBySearch'
                    let data = {
                        orderNoOrPartyName:query
                    }
                    ajax.formRes(url, data).then(res => {
                       if (200 == res.info.code) {
                            const list = res.data.map(item => {
                                return {
                                    value: item.order_no,
                                    label: item.party_name
                                };
                            });
                            that.orderNoList = list;
                        } else {
                            that.$Message.success('数据原因，请联系管理员。');
                        }
                    }).catch(res => {
                        console.log('有错误信息')
                    })
                }, 200);
            } else {
                this.options1 = [];
            }

        },
        //公司名称搜索
        remoteMethod2 (query) {
            let that = this
            if (query !== '') {
                this.loading2 = true;
                setTimeout(() => {
                    this.loading2 = false;
                    let url = '/adminlogin/transport/getCjPartyListBySearch'
                    let data = {
                        partyName:query
                    }
                    ajax.formRes(url, data).then(res => {
                       if (200 == res.info.code) {
                            const list = res.data.map(item => {
                                return {
                                    value: item.name,
                                    label: item.id
                                };
                            });
                            that.partyList = list;
                        } else {
                            that.$Message.success('数据原因，请联系管理员。');
                        }
                    }).catch(res => {
                        console.log('有错误信息')
                    })
                }, 200);
            } else {
                this.options1 = [];
            }

        },
        addCar(){
            this.car_data = {
                car_brand:'',//车辆品牌
                car_series:'',//车系
                car_size:'',//车型
                can_drive:0,//是否能动
                valuation:'',//车辆估值
                car_count:1//运送数量
            }
            this.addCarModel = true

        },
        goBack () {
            this.$router.push({
                name: 'orderhandleindex'
            })
        }

    },
    created: function () {
        this.init()
    },
    activated: function () {
        this.init()
    }
}
</script>
<style>
    .demo-upload-list-cover{
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,.6);
    }
    .card-upload:hover .demo-upload-list-cover{
        display: block;
    }
    .demo-upload-list-cover i{
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }
    .demo-spin-icon-load{
        animation: ani-demo-spin 1s linear infinite;
    }
    @keyframes ani-demo-spin {
        from { transform: rotate(0deg);}
        50%  { transform: rotate(180deg);}
        to   { transform: rotate(360deg);}
    }
    .demo-spin-col{
        height: 100px;
        position: relative;
        border: 1px solid #eee;
    }
</style>

